package com.dream.keigezhushou.Activity.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;


import com.dream.keigezhushou.Activity.acty.listen.golden.Golde30sMuscWordsActivity;
import com.dream.keigezhushou.R;

import java.util.ArrayList;

/**
 * Created by mxmf-001 on 17/2/25.
 */
public class ThirdAdapter extends BaseAdapter implements View.OnClickListener{
    private  Context context;
    private ArrayList<String>mms;
    private LayoutInflater inflater;
    public ThirdAdapter(Context context, ArrayList<String> mms) {
        this.context=context;
        this.mms=mms;
        this.inflater=LayoutInflater.from(context);



    }


    @Override
    public int getCount() {
        return mms.size();
    }

    @Override
    public String getItem(int position) {
        return mms.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder=null;
        if(convertView==null){
            convertView=inflater.inflate(R.layout.local_music_list_item,null);
            holder=new ViewHolder();
            holder.itemLinear= (RelativeLayout) convertView.findViewById(R.id.item_linear);
            holder.tvTitle=(TextView)convertView.findViewById(R.id.tv_title);
            holder.tvSinger=(TextView)convertView.findViewById(R.id.tv_text);
            convertView.setTag(holder);

        }
        holder=(ViewHolder)convertView.getTag();
        String mms=getItem(position);
        holder.tvSinger.setText("阿桑");
        holder.tvTitle.setText("一直很安静");

         holder.itemLinear.setOnClickListener(this);

        return convertView;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.item_linear:
//                Toast.makeText(context,"吖吖",Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(context, Golde30sMuscWordsActivity.class);
               context.startActivity(intent);
                break;


        }

    }


    class  ViewHolder{

        RelativeLayout itemLinear;
        TextView tvTitle;
        TextView tvSinger;

    }


}
